package models.curriculum;

import play.*;
import play.db.jpa.*;

import javax.persistence.*;
import java.util.*;

@Entity
public class Curriculum extends Model {
	
    public Curriculum(String name) {
		this.name = name;
		this.subjects = new ArrayList<Subject>();
	}
    
    public Curriculum addSubject(String name, String description) {
    	Subject subject = new Subject(name, description, this).save();
        this.subjects.add(subject);
        this.save();
        return this;
    }
    
	public String name;
    public String description;
    
    @OneToMany(mappedBy="curriculum", cascade=CascadeType.ALL)
    public List<Subject> subjects;
}
